<template>
	<div>

		<v-header :headerLeftText="leftText" :headerCenterText="headerText"></v-header>
		
		<div class="container bgd_color_gray">

			<div class="pad_lr26 box_size_border width100 bgd_color_white">
				<div class="border_bot1 line_height100 f_size24">
					<label class="display_inline_block width116" for="">店铺名称</label>
					<input v-model="shopName" class="line_height98 box_size_border border_none" type="text" placeholder="请输入店铺名称" />
				</div>
			</div>
			<div class="pad_lr26 box_size_border width100 bgd_color_white">
				<div class="border_bot1 line_height100 f_size24">
					<v-distpicker @province="selectedProvince" @city="selectedCity" @selected="onSelected"></v-distpicker>
				</div>
			</div>
			<div class="pad_lr26 box_size_border width100 bgd_color_white">
				<div class="border_bot1 line_height100 f_size24">
					<label class="display_inline_block width116" for="">具体地址</label>
					<input v-model="detail" class="line_height98 box_size_border border_none" type="text" placeholder="请输入具体地址" />
				</div>
			</div>
			<div class="margin_t50 margin_lr20 box_size_border">
				<button @click="applyShopBtn" class="f_size32 f_color_white bgd_color_main width_100 line_height80 border_none border_radius20">申请</button>
			</div>
		</div>
	</div>
</template>
<script>
	import { Toast } from 'mint-ui';
	export default {
		created() {

		},
		data() {
			return {
				leftText: '',
        headerText: '申请开通店铺',
				shopName: '',
				province: '',
				city: '',
				area: '',
				detail: ''
			}
		},
		methods: {
			selectedProvince(province) {
				this.province = province.value
			},
			selectedCity(city) {
				this.city = city.value
			},
			onSelected(data) {
				this.province = data.province.value
				this.city = data.city.value
				this.area = data.area.value
			},
			applyShopBtn: function() {
				var self = this
				self.$api.post('/front/ShopApply', {
					shopName: self.shopName,
					province: self.province,
					city: self.city,
					area: self.area,
					detail: self.detail
				}, r => {
					console.log('申请店铺r', r)
					if(r.code == 400) {
						Toast(r.error)
					} else {
						Toast(r.data)
//						self.$router.back(-1)
					}
				})
			}
		},
	}
</script>

<style>

</style>